package fr.afcepf.ai89.esharing.managedbean;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import fr.afcepf.ai89.esharing.entity.Emprunt;
import fr.afcepf.ai89.esharing.entity.Proprietaire;
import fr.afcepf.ai89.esharing.metier.BusinessEmpruntAem;
import fr.afcepf.ai89.esharing.metier.BusinessPretAem;
import fr.afcepf.ai89.esharing.metier.IBusinessEmpruntAem;
import fr.afcepf.ai89.esharing.metier.IBusinessPretAem;

public class PretsAnnulesManagedBean {

	IBusinessPretAem busPret = new BusinessPretAem();
	List<Emprunt> pretsAnnules = new ArrayList<Emprunt>();
	
	ConnexionManagedBean mbConnexion = new ConnexionManagedBean();
	PretsManagedBean mbPrets = new PretsManagedBean();
	
	public PretsManagedBean getMbPrets() {
		return mbPrets;
	}

	public void setMbPrets(PretsManagedBean mbPrets) {
		this.mbPrets = mbPrets;
	}

	public ConnexionManagedBean getMbConnexion() {
		return mbConnexion;
	}

	public void setMbConnexion(ConnexionManagedBean mbConnexion) {
		this.mbConnexion = mbConnexion;
	}

	public IBusinessPretAem getBusPret() {
		return busPret;
	}
	
	public void setBusEmp(IBusinessPretAem busPret) {
		this.busPret = busPret;
	}
	
	public List<Emprunt> getPretsAnnules() {
		
		pretsAnnules = busPret.getPretsAnnules(mbPrets.getMbConnexion().getPropConnecte().getProp());
		
//		Proprietaire p = new Proprietaire();
//		p.setIdUtilisateur(3);
//		pretsAnnules = busPret.getPretsAnnules(p);
		
		for (Emprunt em : getPretsAnnules()) {
			
			//System.out.println("***LOOKIEMEE***");
			//System.out.println(em.getIdEmprunt() + " " + em.getDateDebut() + " " + em.getDateFin());
			
		}
		
		return pretsAnnules;
	}
	
	public void setPretsAnnules(List<Emprunt> pretsAnnules) {
		this.pretsAnnules = pretsAnnules;
	}
		
	public PretsAnnulesManagedBean() {
		
		
	}
	
}
